﻿using System.ComponentModel;
using SuppKids.Core;

namespace SuppKids.ViewModels
{
    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
                handler(this, new PropertyChangedEventArgs(Lambda.Property<ViewModelBase>(x => x.AllFieldsIsNotEmpty)));
            }

        }

        public abstract bool AllFieldsIsNotEmpty { get; }
    }
}